env:
  global:
    - NVM_SYMLINK_CURRENT=true
    - PACKAGE="Nodejs" # Package name
    - SUBLIME_TEXT_VERSION="3"
    - PLUGIN_VERSION="2.0.3"
    # use UNITTESTING_TAG to specific tag of UnitTesting
    # - UNITTESTING_TAG="master"

branches:
  only:
    - master

# mutliple os matrix
# https://docs.travis-ci.com/user/multi-os/#Python-example-(unsupported-languages)
matrix:
  include:
    - os: linux
      language: node_js
      node_js: "6.12.2"
      env: 
        - NODEJS_VERSION="v6.12.2"
    - os: linux
      language: node_js
      node_js: "8.9.3"
      env:
        - NODEJS_VERSION="v8.9.3"
    - os: osx
      language: node_js
      node_js: "6.12.2"
      env:
        - NODEJS_VERSION="v6.12.2"
    - os: osx
      language: node_js
      node_js: "8.9.3"
      env:
        - NODEJS_VERSION="v8.9.3"


before_install:
  - curl -OL https://raw.githubusercontent.com/randy3k/UnitTesting/master/sbin/travis.sh
  # enable gui, see https://docs.travis-ci.com/user/gui-and-headless-browsers
  - if [ "$TRAVIS_OS_NAME" == "linux"  ]; then
          export DISPLAY=:99.0;
          sh -e /etc/init.d/xvfb start;
    fi
  - export NVM_SYMLINK_CURRENT=true

install:
  - nvm alias default $NODEJS_VERSION; nvm use $NODEJS_VERSION
  # bootstrap the testing environment
  - sh travis.sh bootstrap
  # install Package Control and package denepdencies
  - sh travis.sh install_package_control
  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then
          touch "$HOME/Library/Application Support/Sublime Text 3/Packages/Nodejs/.debug_plugin";
    fi
  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then
          touch $HOME/.config/sublime-text-3/Packages/Nodejs/.debug_plugin;
    fi

script:
  # run tests with test coverage report
  - sh travis.sh run_tests --coverage
  # testing syntax_test files
  # - sh travis.sh run_syntax_tests

after_success:
  # remove the following if `coveralls` is not needed
  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then
          brew update;
          brew install python3;
          pip3 install python-coveralls;
          pip3 install codecov;
    fi
  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then
          apt-get update -qq
          apt-get install -qq python3
          pip install python-coveralls;
          pip install codecov;
    fi
  - coveralls
  - codecov

notifications:
  email: false
        